const getters = {
  sidebar: state => state.app.sidebar,
  device: state => state.app.device,

  token: state => {
    if ( !state.user.token ) {
      state.user.token = localStorage.getItem('token');
    }
    return state.user.token
  },

  routers: state => state.user.routers,
  admin_fullname: state => {
    if ( !state.user.admin_fullname ) {
      state.user.admin_fullname = localStorage.getItem('admin_fullname');
    }
    return state.user.admin_fullname
  },

  admin_username: state => {
    if ( !state.user.admin_username ) {
      state.user.admin_username = localStorage.getItem('admin_username');
    }
    return state.user.admin_username
  },
  id: state => {
    if ( !state.user.id ) {
      state.user.id = localStorage.getItem('id');
    }
    return state.user.id
  },
  schoolId: state => {
    console.log(state);
    console.log(localStorage.getItem('schoolId'));
    if ( !state.schoolId ) {
      state.user.schoolId = localStorage.getItem('schoolId');
    }
    return state.user.schoolId
  },
  group_title: state => {
    if ( !state.user.group_title ) {
      state.user.group_title = localStorage.getItem('group_title');
    }
    return state.user.group_title
  },
}
export default getters
